<template>
  <div class="column items-center guide-list full-width full-height">
    <div class="guide-title bg-positive q-my-md text-center round-borders">请求远程指导事件</div>
    <div v-for="item in userInRequest" :key="item.userID" class="item row bg-positive q-mb-md">
      <div class="bg-secondary col-2 text-center q-pt-sm">ID: {{item.userID}}</div>
      <div class="column col-7 q-pl-md">
        <div class="time">{{new Date().toLocaleString()}}</div>
        <div>{{item.userName}}</div>
      </div>
      <div class="column col-3 items-center">
        <div class="gpsDigit" v-html="getGpsDigit(item.gpsLongtitude,item.gpsLatitude)"></div>
        <img src="../assets/alarm_marker.png">
      </div>
    </div>

    <div v-for="item in userInGuide" :key="item.userID" class="item row bg-positive q-mb-md">
      <div class="bg-secondary col-2 text-center q-pt-sm">ID: {{item.userID}}</div>
      <div class="column col-7 q-pl-md">
        <div class="time">{{new Date().toLocaleString()}}</div>
        <div>{{item.userName}}</div>
      </div>
      <div class="column col-3 items-center">
        <div class="gpsDigit" v-html="getGpsDigit(item.gpsLongtitude,item.gpsLatitude)"></div>
        <img src="../assets/pre_marker.png">
      </div>
    </div>
  </div>
</template>

<script>
import GuideRequest from './GuideRequest.vue'
export default {
  name: 'PageGuideList',
  props: ['userInGuide', 'userInRequest'],
  components: {
    GuideRequest
  },
  data () {
    return {
      //   userInGuide: this.inGuide,
      //   userInRequest: this.inRequest
    }
  },
  methods: {
    getGpsDigit (lng, lat) {
      let alng = parseFloat(lng).toFixed(2)
      let alat = parseFloat(lng).toFixed(2)
      return `(${alng},${alat})`
    }
  },
  mounted () { }
}
</script>

<style lang='stylus'>
.guide-list {
  .guide-title {
    width: 50%;
  }

  .item {
    width: 90%;
  }

  img {
    width: 26px;
    height: 26px;
  }

  .time {
    font-size: 0.5rem;
  }

  .gpsDigit {
    font-size: 0.5rem;
  }
}
</style>
